package com.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.common.ServiceExceptionUtils;
import com.example.mapper.AccountMapper;
import com.example.po.AccountPO;
import com.example.service.AccountService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;

/*
@description:
@ClassName AccountServiceImpl
@author chen
@create 2025-07-09 22:30
@Version 1.0
*/
@Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountPO> implements AccountService
{
    @Resource
    private AccountMapper accountMapper;

    @Override
    public void balanceAdd(String accountId, BigDecimal price)
    {
        int updateCount = accountMapper.balanceAdd(accountId, price);
        if (updateCount != 1)
        {
            throw ServiceExceptionUtils.exception("更新账户余额失败!");
        }

    }
}
